﻿-- Author	: Kurapica

--------------------------
-- ShadowFrame               --
--------------------------
do
	local getmetatable = getmetatable
	local pairs = pairs
	local ipairs = ipairs
	local type = type
	local error = error
	local tinsert = table.insert
	local tremove = table.remove
	local CreateFrame = IGAS.GUI.CreateFrame

	-- Base Form for all other forms in Studio    
	local _WidgetName = "ShadowFrame"
	local _Base = IGAS.GUI.Widget.Frame

    local _Widget = IGAS.Studio.Widget
    local _PropertyType = IGAS.GUI.Base.PropertyType
	
	-- Script
    
	-- ScriptType
	local _ScriptType = {
	}

	-- FuncProxy
	local _FuncProxy = {
		-- SetName(name) - Set the name of the object.
        ["SetName"] = function(self, name)
            self:CallMethod(_Base, "SetName", name)
			self.__Frame.Name = name
        end,
	}

	-- Property
	local _Property = {
		["TrueFrame"] = {
			["Get"] = function(self)
				return self.__Frame
			end,
			
			["Type"] = _PropertyType.Object,
		},
	}

	local function _New(parent, frameType, ...)		
		local shadowF = CreateFrame(_Base, nil, parent)

		shadowF.__Frame = CreateFrame(frameType, nil, shadowF, ...)
		if shadowF.__Frame["SetAllPoints"] then
			shadowF.__Frame:SetAllPoints(shadowF)
		end
		
		return shadowF
	end

	-- Register
	local _WidgetInfo = {
		["WidgetName"] = _WidgetName,
		["Base"] = _Base,
		["FuncProxy"] = _FuncProxy,
		["Property"] = _Property,
		["ScriptType"] = _ScriptType,
		["New"] = _New,
	}

	_Widget[_WidgetName] = IGAS:NewWidget(_WidgetInfo)
end

